<html>
<head>
  <meta http-equiv="content-type" content="text/html; charset=iso-8859-1">
  <title>HTML Generator Sample Page</title>

<script type="text/javascript">

function makeRequest(url)
{
if (window.XMLHttpRequest) { // Mozilla, Safari, ...
      httpRequest = new XMLHttpRequest();
    }
httpRequest.onreadystatechange = alertContents;
    httpRequest.open('GET', url);

    // this starts the send operation
    httpRequest.send();

}
function alertContents() {
    if (httpRequest.readyState === 4) {
      if (httpRequest.status === 200) {

        // since the response from the Jetty server is <h1>Hello World</h1>
         // the alert should fire with that markup
        alert(httpRequest.responseText);

    } else {
      alert('There was a problem with the request.');
    }
  }
}

function myfunction(frm)
{
    var opt=frm.option.value;
    if(opt==3 || opt==4){
       if( opt==3){
       var clientName = prompt('Enter Client Name', ' ');
       makeRequest('/senddata?value='+opt+'&clientname='+clientName);
   }
      if(opt==4){
    window.showModalDialog("request.html", "dialogHeight:200px; dialogLeft:200px;"); 

   }
} else{
    makeRequest('/senddata?value=' + frm.option.value); 
  }
}


</script>
</head>

<body>
<h1 style="text-align: center;">Agent Management Interface</h1>
<ol>
  <li>Start Platform</li>
  <li>Show Agent Status</li>
  <li>Create Dummy Agent</li>
  <li>Intiate Request Message</li>
  <li>Stop Platform</li>
</ol>

<form name="management_form">
  Enter Option: <input type="text" id="optiontb" name="option"> 
  <input type="button" onclick="myfunction(this.form)" value="submit"> </form>
</body>
</html>
